package web_k;

import pojo_k.HomeUserIncome;
import pojo_k.HomeUserPayout;
import service_k.HomeUserService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/homeUserPayoutServlet")
public class HomeUserPayoutServlet extends HttpServlet {
    private HomeUserService service = new HomeUserService();

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String homeuserName = request.getParameter("homeuserName");
        float homeuserQu = Float.parseFloat(request.getParameter("homeuserQu"));


        HomeUserPayout homeUserPayout = new HomeUserPayout();
        homeUserPayout.setHomeuserName(homeuserName);
        homeUserPayout.setHomeuserQu(homeuserQu);

        service.homeUserPayoutAdd(homeUserPayout);

        response.setContentType("text/html;charset=utf-8");
        response.getWriter().write("取款成功！");
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doGet(request, response);
    }
}
